#include "mainWindow.h"
#include <QDebug>

mainWindow::mainWindow(QWidget * parent,Qt::WindowFlags f)
:QWidget(parent,f)
{
    this->slider=new QSlider(Qt::Horizontal,this);
    this->spinBox=new QSpinBox(this);
    this->layout=new QHBoxLayout(this);
    this->layout->addWidget(slider);
    this->layout->addWidget(spinBox);
    this->setLayout(layout);

    connect(this->slider,SIGNAL(valueChanged(int)),this->spinBox,SLOT(setValue(int)));
    connect(this->spinBox,SIGNAL(valueChanged(int)),this->slider,SLOT(setValue(int)));

    //槽函数链接
    connect(this->slider,SIGNAL(valueChanged(int)),this,SLOT(setValue(int)));
}

void mainWindow::setValue(int value)
{
    qDebug()<<value;
}